<template>
  <div>
    <v-header></v-header>
    <!--内容-->
    <div class="ris_cont">
      <div class="ris_cont_headHint">
        模板信息

        <span style="padding-left: 30px">设备类型</span>
        <select v-model="eqptypecode" @change="partGroupsByEqptCode(eqptypecode)" style="width: 140px;">
          <option value=""></option>
          <option v-for="(eqptype,index) in baseeqptypes" :value="eqptype.code">{{eqptype.name}}</option>
        </select>
      </div>

      <div class="ris_tm_cont clear">
        <div class="ris_tm_cont_left ">
          <ul class="ris_tm_cont_left_head clear">
            <li :class="showTemplate==true?'ris_tm_cont_left_head_active':''" @click="activeHeadTemplate(0)">公共模板</li>
            <li :class="showTemplate==false?'ris_tm_cont_left_head_active':''" @click="activeHeadTemplate(1)">个人模板</li>
          </ul>
          <ul class="ris_tm_cont_left_ul">
            <li v-for="(pg,index) in partGroups" v-model="pgcode" >
              <!--@click="MenuToggleone(pg.code,index)"   partGroups.listPart.templateList-->
              <a href="#" class="ris_tm_cont_left_ul_a" @click="MenuToggleone(pg.code,index)" :value="pg.code">{{pg.name}}</a>
              <ul>
                <li v-for="p in pg.listPart" v-model="partcode">
                  <!--@click="MenuToggletwo(p.code)"-->
                  <a href="#" :value="p.code"  :class="p.code==tpartcode?'ris_tm_cont_left_ul_a':'add_a_class'">{{p.name}}</a>
                  <ul>
                    <li  v-for="(t,index) in p.templateList" ><a  @click="getTemplate(t,index)" >{{t.title}}</a></li>
                  </ul>
                </li>
              </ul>
            </li>
          </ul>
        </div>
        <div class="ris_tm_cont_right">
          <table>
            <tr>
              <td>部位组</td>
              <td>
                <select v-model="tpartgroupcode" @change="getpart(tpartgroupcode)">
                  <option v-for="pg in mpartGroups" :value="pg.code"  >{{pg.name}}</option>
                </select>
              </td>
              <td>是否显示</td>
              <td>
                <select v-model="tisuse">
                  <option value="1">是</option>
                  <option value="0">否</option>
                </select>
              </td>
            </tr>
            <tr>
              <td>部位</td>
              <td>
                <select v-model="tpartcode">
                  <option v-for="ap in partsm" :value="ap.code">{{ap.name}}</option>
                </select>
              </td>
              <td>排序号</td>
              <td><input type="number" v-model="tsortnum" @blur="getsortnum()"/></td>
            </tr>
            <!--<tr>-->
            <!--<td>来源编号</td>-->
            <!--<td><input type="text" v-model="tsourcecode"/></td>-->
            <!--<td></td>-->
            <!--<td> </td>-->
            <!--</tr>-->
            <tr>
              <td>危急值</td>
              <td><input type="text" v-model="temerg"/></td>
              <td>阴阳性</td>
              <td>
                <select v-model="tpositive">
                  <!--0 没病  1  有病 -->
                  <option value=""></option>
                  <option value="0">阴性</option>
                  <option value="1">阳性</option>
                </select>
              </td>
            </tr>
            <tr>
              <td>模板名称</td>
              <td><input type="text" v-model="ttitle" @blur="getpycode(ttitle)"/></td>
              <td>拼音码</td>
              <td><input type="text" v-model="tpycode"/></td>
            </tr>
            <tr>
              <td>归属系统</td>
              <td><input type="text" v-model="tsource"/></td>
              <td>归属编号</td>
              <td><input type="text" v-model="tsourcecode"/></td>
            </tr>
            <tr>
              <td>模板描述</td>
              <td colspan="3">
                <textarea class="ris_tm_cont_right_tab_text_first" v-model="tdescription"></textarea>
              </td>
            </tr>
            <tr>
              <td>结论</td>
              <td colspan="3">
                <textarea v-model="tresult"></textarea>
              </td>
            </tr>
            <tr>
              <td>诊断建议</td>
              <td colspan="3">
                <textarea v-model="tadvice" class="ris_tm_cont_xt_three"></textarea>
              </td>
            </tr>
            <tr>
              <td>备注</td>
              <td colspan="3">
                <textarea v-model="tmemo" class="ris_tm_cont_xt_three"></textarea>
              </td>
            </tr>

          </table>
          <div class="ris_tm_cont_right_btn">
            <button class="bg_green" @click="addtemplate()">增加</button>
            <button class="bg_blur" @click="templateSave">保存</button>
            <!--<button>修改</button>-->
            <button class="ris_tm_cont_right_btn_delete bg_yellow" @click="templateDelete()">删除</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>

  import Header from '@/components/Header/Header';
  export default {
    name: 'hello',
    components: {
      'v-header': Header
    },
    props:{
      root:Object
    },
    created(){
      //window.location.href = "http://139.217.17.69:8099/pos/authorize?client_id=b8bcd026b8bc47c88c785d77fe91a601&response_type=code&client_key=a482d714becb475da50b9bd1b7031a87&redirect_uri=http://10.0.2.46:8080/qytj/indexRedirect.html";
//    getPartgroupPart
//      this.$http.get(window.localStorage.url + "/base/getPartgroupPart") //遍历部位组 非isuse
//        .then(function(res) {
//          console.log(res.data.data)
//            this.partGroups = res.data.data;
//        });
//      this.$http.get(window.localStorage.url + "/baseEqptype/getEqptypes") //遍历设备类型 isuse 1  木有关联角色
//        .then(function(res) {
//          this.baseeqptypes = res.data.data;
//
//        });

      this.$http.get(window.localStorage.url+"/base/getDeptEqpEqptypeByActor")//根据角色
        .then(function (res) {
          // console.log(res.data);
          if(res.data.status=='SUCCESS'){
            this.baseeqptypes=res.data.eqptypeList;

            var eqptypecodes=[];
//            console.log(this.baseeqptypes.size)
            for(var i = 0;i<this.baseeqptypes.size;i++){
              eqptypecodes.push(res.data.eqptypeList[i].code);
//               console.log(eqptypecodes);
//               console.log(i)
            }
//            console.log(eqptypecodes);

          }
        });


      this.$http.get(window.localStorage.url + "/template/partGroupsByEqptCode?code="+this.eqptypecode+"&variablepc=2") //组合下的部位
        .then(function(res) {
//            console.log(res.data.data);
          if(res.data.status == 'SUCCESS') {
            this.partGroups=res.data.data;

          }else{

//              this.$http.get(window.localStorage.url + "/partgroup/findpartGroupByisuse") //遍历部位组合 isuse 1
//                .then(function(res) {
//                  this.partGroups = res.data.data;
//                });

          }
        });









      this.$http.get(window.localStorage.url + "/partgroup/findpartGroupByisuse?eqptypecode="+this.eqptypecode+"&variablepc="+this.variablepc) //遍历部位组合 isuse 1
        .then(function(res) {
          this.mpartGroups = res.data.data;
        });

//      this.$http.get(window.localStorage.url + "/base/getPart")//遍历所有部位
//        .then(function(res) {
//            this.allparts = res.data.data;
//        });


    },
    data () {
      return {
        //设备类型
        baseeqptypes:[],
//        选中的code
        eqptypecode:"",
        url:"",
        showTemplate:true,
        //部位组合
        partGroups:"",
        //模板下的部位组合
        mpartGroups:"",
        //allparts
        allparts:"",
        //组合下的部位
        parts:"",
        //模板下的部位
        partsm:"",
        //当前code
        pgcode:"",
        //模板s
        templates:[],
        //dangqian code
        partcode:"",
        //模态 属性
        tadvice:"",
        tcode:"",
        tdescription:"",
        temerg:"",
        tid:"",
        tisuse:1,
        tpartcode:"",
        tpartgroupcode:"",
        tpositive:"",
        tpycode:"",
        tresult:"",
        tsortnum:"",
        ttitle:"",
        tusercode:"",
        tmemo:"",
        tsource:"",
        tsourcecode:"",

        //1 添加 2修改
        variable:"",
        //个人或公共模板, 个人1 公共2
        variablepc:2,
        modalNum:0,

//        index1:'',
      }
    },
    mounted(){
//      $('.ris_tm_cont_left_ul>li>a').click(function(){
//        $(this).parents('li').siblings('li').children('ul').hide();
//      })
      $('.ris_tm_cont_left_ul').on('click','a',function () {
        $(this).siblings('ul').toggle();
        $(this).parent('li').siblings('li').find('ul').hide();
      })




    },
    methods:{

      //公共弹窗
      addModal:function (text,time) {
        $pg.popup({
          text:text,//显示的文本
          btnClass:'delete',//确定按钮的类值  必传  方便查找确定按钮的class值reBtn
          btnBgColor:'#4f56a3',//按钮的颜色
          btnToggle:{
            btnDetermine:true,//确定按钮是否显示
            btnCancel:false,//取消按钮是否显示
          },
          timeOut:time,
        });
      },

//      设备类型下 根据 部位 查出部位组  再次点击部位组时 带设备类型code和部位组code 查询部位
//      再次点击 清空部位 关闭部位
      partGroupsByEqptCode(eqptypecode){

        $('.ris_tm_cont_left_ul>li ul').hide();
//        console.log(eqptypecode);

        this.parts="";

        this.$http.get(window.localStorage.url + "/template/partGroupsByEqptCode?code="+eqptypecode+"&variablepc="+this.variablepc) //组合下的部位
          .then(function(res) {

            console.log(res.data.data);

            if(res.data.status == 'SUCCESS') {

              this.partGroups=res.data.data;
              this.dataparts=res.data.datapart;

            }else{
              this.partGroups="";
//              this.$http.get(window.localStorage.url + "/partgroup/findpartGroupByisuse") //遍历部位组合 isuse 1
//                .then(function(res) {
//                  this.partGroups = res.data.data;
//                });

            }
          });
//        console.log("change事件")
        this.$http.get(window.localStorage.url + "/basePart/getbasePartByGroupCode1?groupcode="+ this.tpartgroupcode+"&eqptypecode="+eqptypecode) //组合下的部位
          .then(function(res) {
            this.partsm= res.data.data;
            if(res.data.data!=null){
              this.tpartcode= res.data.data[0].code;
            }
//            console.log(res.data.data);
          });





      },





      //二级菜单的显示和隐藏
      MenuToggleone(code,index){
        this.parts="";

        this.tpartgroupcode=code;
//
//        $(event.currentTarget).siblings('ul').toggle();
//        $(event.currentTarget).siblings('ul').find('ul').hide();
//        $(event.currentTarget).parent().siblings().children('ul').hide();
////        this.index1=index1;
////        console.log(this.variablepc);
//        this.$http.get(window.localStorage.url + "/basePart/getbasePartByGroupCode?groupcode="+code+"&eqptypecode="+this.eqptypecode
//          +"&variablepc="+this.variablepc) //组合下的部位  公共 /  个人
//          .then(function(res) {
//
//            if(res.data.status=="SUCCESS"){
////              console.log(res.data.data);
//              this.parts= res.data.data;
////            this.partsm= res.data.data;//模态下的
////            if(this.partsm!=""){
////              this.tpartcode= res.data.data[0].code;//模板下的默认第一个
////            }
//            }else{
//              console.log(res.data.data)
//            }
//
//          });
        this.getpart(code,this.eqptypecode);//模态 下的部位
      },

//      //三级
//      MenuToggletwo(code){
//
//        this.templates="";
////        this.index2=null;// 选中颜色
//        console.log("三级菜单");
//
//        this.tpartcode=code;//模版下部位的code
////        console.log(this.tpartcode);
//        function aaa() {
//          $(event.currentTarget).siblings('ul').toggle();
//          $(event.currentTarget).parent().siblings().children('ul').hide();
//          $(event.currentTarget).parent('li').siblings('li').children('ul').hide();
//        }
//        function intv() {
//          aaa();
//        }
//        var int=setInterval(intv(),500);
//        this.$http.get(window.localStorage.url + "/template/findTemplate?code="+code+"&variablepc="+this.variablepc+"&eqtypecode="+this.eqptypecode)
//          .then(function(res1) {
//            if(res1.data.status == 'SUCCESS') {
//
//              this.templates= res1.data.data;
//
//              clearInterval(int);
//            }else{
//              this.templates="";
//              this.tid="";
//              this.tadvice="";
//              this.tcode="";
//              this.tdescription="";
//              this.temerg="";
//              this.tid="";
//              this.tisuse="";
////              this.tpartcode="";
////              this.tpartgroupcode=t.partgroupcode;
//              this.tpositive="";
//              this.tpycode="";
//              this.tresult="";
//              this.tsortnum="";
//              this.ttitle="";
////        this.tusercode=t.usercode;
//              this.tmemo="";
//              this.tsourcecode="";
//              this.tsource="";
//              $(this).parents('li').siblings('li').children('ul').hide();
////              this.addModal(res1.data.data,true);//公共弹窗
//            }
//          });
//      },
      getTemplate(t,index){//三级模板
        $('.ecdlActive').removeClass('ecdlActive');
        $(event.currentTarget).addClass('ecdlActive');

        this.variable="";//改变状态  为修改
//        this.index2=index;
        this.tid=t.id;
        this.tadvice=t.advice;
        this.tcode=t.code;
        this.tdescription=t.description;
        this.temerg=t.emerg;
//        this.tid=t.id;
        this.tisuse=t.isuse;
        this.tpartcode=t.partcode;
        this.tpartgroupcode=t.partgroupcode;
        this.tpositive=t.positive;
        this.tpycode=t.pycode;
        this.tresult=t.result;
        this.tsortnum=t.sortnum;
        this.ttitle=t.title;
//        this.tusercode=t.usercode;
        this.tmemo=t.memo;
        this.tsourcecode=t.sourcecode;
        this.tsource=t.source;
//        console.log(this.tid+"   9797979797979");
      },
      //模板的切换
      activeHeadTemplate(num){
        $('.ecdlActive').removeClass('ecdlActive');
        if(num==0){//公共模板
          this.showTemplate=true;
          this.variablepc=2;
        }else if(num==1){//个人模板
          this.showTemplate=false;
          this.variablepc=1;
        }

       this.partGroupsByEqptCode(this.eqptypecode,this.variablepc);

        if(num!=this.modalNum){
          this.parts="";
          this.templates="";
          $('.ris_tm_cont_left_ul').find('ul').hide();
        }

        this.modalNum=num;
      },
      //删除按钮
      templateDelete(){
        var  _that=this;
        $pg.popup({
          text:"确定删除吗？",//显示的文本
          bgColor:"#f5f5f5", //背景皮肤
          width:'280',//设置宽度
          height:'170',//设置高度
          btnClass:'templateDeleteaaa',//确定按钮的类值  必传
          bgOpacity:'0',//大背景的透明度
          headBgColor:'#eee',//头部颜色
          headColor:"#333",//头部字体颜色
          btnBgColor:'#4f56a3',//按钮的颜色
          btnToggle:{
            btnDetermine:true,//确定按钮是否显示
            btnCancel:true,//取消按钮是否显示
          },
          btnColor:'#fff',//按钮的字体颜色
          determine:function(){
//            console.log(_that.tid+"*-*-"+_that.tcode);
            if(!_that.tcode){
              $pg.popup({
                text: "请选中要删除的模板！",//显示的文本
                btnClass: 'delete',//确定按钮的类值  必传  方便查找确定按钮的class值reBtn
                btnBgColor: '#4f56a3',//按钮的颜色
                btnToggle:{
                  btnDetermine:true,//确定按钮是否显示
                  btnCancel:false,//取消按钮是否显示
                }
              });
              return;
            }


            _that.$http.get(window.localStorage.url + "/template/templateDelete?code="+_that.tcode+"&id="+_that.tid) //部位下的模板
              .then(function(res) {
//            console.log(res.data.data);
                if(res.data.status == 'SUCCESS') {
//                  this.index2=null;
                  this.addModal(res.data.data,1);//公共弹窗

                  this.tadvice="";
                  this.tcode="";
                  this.tdescription="";
                  this.temerg="";
                  this.tid="";
                  this.tisuse=1;
//                  this.tpartcode="";
//                  this.tpartgroupcode="";
                  this.tpositive="";
                  this.tpycode="";
                  this.tresult="";
                  this.tsortnum="";//排序号  最大值
                  this.ttitle="";
//       this.tusercode=t.usercode;
                  this.tmemo="";
                  this.tsourcecode="";
                  this.tsource="";

//                  _that.$http.get(window.localStorage.url + "/template/findTemplate?code="+_that.tpartcode+"&variablepc="+_that.variablepc+"&eqtypecode="+_that.eqptypecode)
//                    .then(function(res1) {
//                      if(res1.data.status == 'SUCCESS') {
//                        _that.templates= res1.data.data;
//                      }else{
//                        _that.templates="";//删除为空时  清空关闭
//                      }
//                    });

                  _that.$http.get(window.localStorage.url + "/template/partGroupsByEqptCode?code="+_that.eqptypecode+"&variablepc="+_that.variablepc) //组合下的部位
                    .then(function(res) {

                      console.log(res.data.data);

                      if(res.data.status == 'SUCCESS') {

                        _that.partGroups=res.data.data;
                        _that.dataparts=res.data.datapart;

                      }else{
                        _that.partGroups="";
                      }
                    });


                }else{
                  this.addModal(res.data.data,true);//公共弹窗
                }
              });


          },//确定按钮执行的方法
        });
      },

      //sortnum 为空时默认为0
      getsortnum(){
        if(this.tsortnum==""){
          this.tsortnum=0;
        }
      },

      //点击部位组合组获得部位
      getpart(code){

        //清空 模态
//        this.tadvice="";
//        this.tcode="";
//        this.tdescription="";
//        this.temerg="";
//        this.tid="";
//        this.tisuse=1;
////        this.tpartcode="";
////        this.tpartgroupcode="";
//        this.tpositive=0;
//        this.tpycode="";
//        this.tresult="";
//        this.tsortnum="";//排序号  最大值
//        this.ttitle="";
////       this.tusercode=t.usercode;
//        this.tmemo="";
//        this.tsourcecode="";
//        this.tsource="";
////        this.variable=1;

//        console.log(this.eqptypecode);
        //模板下的部位
        this.tpartgroupcode=code;
        this.$http.get(window.localStorage.url + "/basePart/getbasePartByGroupCode1?groupcode="+code+"&eqptypecode="+this.eqptypecode) //组合下的部位
          .then(function(res) {
            this.partsm= res.data.data;
            if(res.data.data!=null){
              this.tpartcode= res.data.data[0].code;
            }
//            console.log(res.data.data);
          });
//        this.tpartgroupcode=code;
      },

      //获取拼音码
      getpycode(ttitle) {
        this.$http.get(window.localStorage.url + "/pytool/getPyCode?name=" +ttitle)
          .then(function(res) {
            if(res.data.status == 'SUCCESS') {
              this.tpycode = res.data.data;
            }
          });
      },

      addtemplate(){
        $('.ecdlActive').removeClass('ecdlActive');
        this.$http.get(window.localStorage.url + "/template/findMaxNum")
          .then(function(res) {
            this.tsortnum= res.data.data;
          });

        if(this.tpartgroupcode==''){

          this.$http.get(window.localStorage.url + "/base/getPartgroupPart") //遍历部位组
            .then(function(res) {
              this.partGroups = res.data.data;
              this.tpartgroupcode=this.partGroups[0].code;
              this.$http.get(window.localStorage.url + "/basePart/getbasePartByGroupCode?groupcode="+this.tpartgroupcode) //组合下的部位
                .then(function(res) {
                  this.parts= res.data.data;
                  this.tpartcode=this.parts[0].code;
                });
            });

        }
        this.tadvice="";
        this.tcode="";
        this.tdescription="";
        this.temerg="";
        this.tid="";
        this.tisuse=1;
//        this.tpartcode="";
//        this.tpartgroupcode="";
        this.tpositive="";
        this.tpycode="";
        this.tresult="";
//        this.tsortnum="";//排序号  最大值
        this.ttitle="";
//       this.tusercode=t.usercode;
        this.tmemo="";
        this.tsourcecode="";
        this.tsource="";
        this.variable=1;
      },
//      getpartcode(code){
//        console.log(this.tpartcode,code)
//      },
      //保存按钮
      templateSave(){


        if(!this.tpartgroupcode){
          $pg.popup({
            text:"部位组合不能为空！",//显示的文本
            btnClass:'delete',//确定按钮的类值  必传  方便查找确定按钮的class值reBtn
            btnBgColor:'#4f56a3',//按钮的颜色
            determine:function(){

            },//点击确定执行的方法
          });

          return;
        }

        if(this.ttitle==""){

          $pg.popup({
            text:"名称不能为空！",//显示的文本
            btnClass:'delete',//确定按钮的类值  必传  方便查找确定按钮的class值reBtn
            btnBgColor:'#4f56a3',//按钮的颜色
            determine:function(){

            },//点击确定执行的方法
          });

          return;
        }

        if(!this.tpartcode){
          $pg.popup({
            text:"部位不能为空！",//显示的文本
            btnClass:'delete',//确定按钮的类值  必传  方便查找确定按钮的class值reBtn
            btnBgColor:'#4f56a3',//按钮的颜色
            determine:function(){

            },//点击确定执行的方法
          });

          return;
        }

        if(this.tpositive==undefined){
          this.tpositive="";
        }

//        if(this.tsortnum==""){
//
//          $pg.popup({
//            text:"排序号不能为空！",//显示的文本
//            btnClass:'delete',//确定按钮的类值  必传  方便查找确定按钮的class值reBtn
//            btnBgColor:'#4f56a3',//按钮的颜色
//            determine:function(){
//
//            },//点击确定执行的方法
//          });
//
//          return;
//        }

        var _that=this;
        $pg.popup({
          text:"确定执行吗？",//显示的文本
          bgColor:"#f5f5f5", //背景皮肤
          width:'280',//设置宽度
          height:'170',//设置高度
          btnClass:'templateDeleteaaa',//确定按钮的类值  必传
          bgOpacity:'0',//大背景的透明度
          headBgColor:'#eee',//头部颜色
          headColor:"#333",//头部字体颜色
          btnBgColor:'#4f56a3',//按钮的颜色
          btnToggle:{
            btnDetermine:true,//确定按钮是否显示
            btnCancel:true,//取消按钮是否显示
          },
          btnColor:'#fff',//按钮的字体颜色
          determine:function(){
//            console.log(_that.variable);
            if(_that.variable==1){//添加
//              console.log("添加"+_that.tpartgroupcode+"*-*-*-"+ _that.tpartcode);
              _that.$http.get(window.localStorage.url + "/template/addTemplate?title="+_that.ttitle+ "&partgroupcode="+_that.tpartgroupcode+"&partcode="+ _that.tpartcode+
                "&pycode="+_that.tpycode+"&emerg="+_that.temerg+ "&positive="+_that.tpositive+"&description="+_that.tdescription+"&result="+_that.tresult+"&advice="+_that.tadvice+"&isuse="+_that.tisuse+
                "&sortnum="+_that.tsortnum+"&memo="+_that.tmemo +"&source="+_that.tsource+"&sourcecode="+_that.tsourcecode+"&variablepc="+_that.variablepc+"&eqptypecode="+_that.eqptypecode)
                .then(function(res) {
                  if(res.data.status == 'SUCCESS') {

                    _that.addModal(res.data.data,1);//公共弹窗

//                    _that.$http.get(window.localStorage.url + "/template/findTemplate?code="+_that.tpartcode+"&variablepc="+_that.variablepc+"&eqtypecode="+_that.eqptypecode)
//                      .then(function(res1) {
//                        if(res1.data.status == 'SUCCESS') {
//                          _that.partGroups.listPart.templateList= res1.data.data;
//                        }
//                      });

                    _that.$http.get(window.localStorage.url + "/template/partGroupsByEqptCode?code="+_that.eqptypecode+"&variablepc="+_that.variablepc) //组合下的部位
                      .then(function(res) {

                        console.log(res.data.data);

                        if(res.data.status == 'SUCCESS') {

                          _that.partGroups=res.data.data;
                          _that.dataparts=res.data.datapart;

                        }else{
                          _that.partGroups="";
                        }
                      });




                  }else{
                    _that.variable=1;
                    _that.addModal(res.data.data,true);//公共弹窗
                  }
                });
              _that.variable="";
            }else{//修改
//              console.log(_that.tcode);
              _that.$http.get(window.localStorage.url + "/template/updateTemplate?code="+_that.tcode+"&title="+_that.ttitle+ "&partgroupcode="+_that.tpartgroupcode+"&partcode="+ _that.tpartcode+
                "&pycode="+_that.tpycode+"&emerg="+_that.temerg+ "&positive="+_that.tpositive+"&description="+_that.tdescription+"&result="+_that.tresult+"&advice="+_that.tadvice+"&isuse="+_that.tisuse+
                "&sortnum="+_that.tsortnum+"&memo="+_that.tmemo +"&source="+_that.tsource+"&sourcecode="+_that.tsourcecode+"&id="+_that.tid+"&variablepc="+_that.variablepc+"&eqptypecode="+_that.eqptypecode)
                .then(function(res) {
                  if(res.data.status == 'SUCCESS') {
//                    console.log(res.data.data);
                    this.addModal(res.data.data,1);//公共弹窗

                    _that.$http.get(window.localStorage.url + "/template/partGroupsByEqptCode?code="+_that.eqptypecode+"&variablepc="+_that.variablepc) //组合下的部位
                      .then(function(res) {

                        console.log(res.data.data);

                        if(res.data.status == 'SUCCESS') {

                          _that.partGroups=res.data.data;
                          _that.dataparts=res.data.datapart;

                        }else{
                          _that.partGroups="";
                        }
                      });

                  }else{
                    this.addModal(res.data.data,true);//公共弹窗
                  }
                });
            }



          },//确定按钮执行的方法
        });
      }



    },
//	    beforeUpdate() {
//		    this.$nextTick(function(){
//
//		    })
//		},

  }

</script>

<style scoped>
  .ris_cont_headHint{
    height: 40px;
    background-color: #999;
    color: #f1f1f1;
    line-height: 40px;
    padding-left: 30px;
    box-sizing: border-box;
  }



  .ris_tm_cont{
    width: 95%;
    margin: 20px auto;
  }
  .ris_tm_cont_left{
    width: 23%;
    border: 1px solid #ccc;
    float: left;
    background-color: #fff;
    border-top: 0;
    border-bottom: 0;
  }
  .ris_tm_cont_left_head{
    width: 100%;
    text-align: center;
    height: 40px;
    line-height: 40px;
    font-weight: bold;
    border-top: 1px solid #ddd;
  }
  .ris_tm_cont_left_head>li{
    display: inline-block;
    width: 50%;
    float: left;
    background-color: #fff;
    color: #b47658;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
  }
  .ris_tm_cont_left_head>li.ris_tm_cont_left_head_active{
    background-color: #999;
    color: #fff;
  }

  /*三级菜单*/
  /*列表样式*/
  .ris_tm_cont_left_ul{
    line-height: 32px;
    width: 100%;
    height: 543px;
    overflow-x: hidden;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    overflow-y: auto;
  }
  .ris_tm_cont_left_ul ul{
    display: none;
  }
  .ris_tm_cont_left_ul li{
    cursor: pointer;
  }
  .ris_tm_cont_left_ul li a{
    display: block;
    width: 100%;
    height: 100%;
    /*border-bottom: 1px solid #fff;*/
  }
  .ris_tm_cont_left_ul>li>a{
    padding-left: 10px;
    background-color: #aaa;
    border-bottom: 1px solid #ccc;
    color: #fff;
    /*border-top: 1px solid #aaa;*/
  }
  .ris_tm_cont_left_ul>li>ul>li>a{
    padding-left: 30px;
    background-color: #efefef;
    border-bottom: 1px solid #ccc;
    color: #666;
  }
  .ris_tm_cont_left_ul>li>ul{
    display: none;
  }
  .ris_tm_cont_left_ul>li>ul>li>ul>li{
    position: relative;
  }
  .ris_tm_cont_left_ul>li>ul>li>ul>li>a{
    padding-left: 50px;
    background-color: #fff;
    border-bottom: 1px solid #ccc;
    color: #666;
  }
  .ris_tm_cont_left_ul>li>ul>li>ul>li>a.add_a_class{
    color: #0000ff;
  }
  /*.ris_tm_cont_left_ul>li>ul>li>ul>li> span{*/
  /*color: #ff6912;*/
  /*position: absolute;*/
  /*right: 10px;*/
  /*top: 0px;*/
  /*}*/
  .ris_tm_cont_left_ul>li>ul>li>ul{
    display: none;
  }
  a.ris_tm_cont_left_ul_active{
    color: #ffb53e !important;
  }


  /*右边*/
  .ris_tm_cont_right{
    width: 73%;
    float: right;
    background-color: #fff;
    border: 1px solid #ccc;
    padding-top: 22px;
    line-height: 42px;
  }
  .ris_tm_cont_right>table{
    width: 80%;
    margin: 0 auto;
  }
  .ris_tm_cont_right>table tr td{

  }
  .ris_tm_cont_right>table tr td:nth-child(1){width: 15%;text-align: right;padding-right: 20px;}
  .ris_tm_cont_right>table tr td:nth-child(2){width: 35%;}
  .ris_tm_cont_right>table tr td:nth-child(3){width: 15%;text-align: right;padding-right: 20px;}
  .ris_tm_cont_right>table tr td:nth-child(4){width: 35%;}
  .ris_tm_cont_right>table tr td input,.ris_tm_cont_right>table tr td select,.ris_tm_cont_right>table tr td textarea{
    width: 100%;
    border: 1px solid #999;
  }
  .ris_tm_cont_right>table tr td input,.ris_tm_cont_right>table tr td select{
    height: 28px;
    border-radius: 12px;
    padding: 0 10px;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
  }
  .ris_tm_cont_right>table tr td textarea{
    height: 100px;
    padding: 5px 10px;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid #999;
    /*margin-top: 10px;*/
  }
  .ris_tm_cont_right>table tr td textarea.ris_tm_cont_right_tab_text_first{
    margin-top: 12px;
  }

  /*按钮*/
  .ris_tm_cont_right_btn{
    padding-left: 50px;
    text-align: right;
    margin: 50px 10% 30px 0;
  }
  .ris_tm_cont_right_btn button{
    width: 90px;
    height: 34px;
    border: 0;
    background-color:#215c84;
    color: #fff;
    border-radius: 15px;
    margin-left: 7%;
    cursor: pointer;
  }
  .ris_tm_cont_right_btn button:hover{
    background-color: #1a4161;
  }
  /*.ris_tm_cont_right_btn button.ris_tm_cont_right_btn_delete{*/
  /*background-color: #bb6260;*/
  /*}*/

  /*删除的模态*/
  /*点击删除弹出的模态框*/
  .ris_tm_delete{
    position: fixed;
    z-index: 800;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(66,66,66,.2);
    display: none;
  }
  .ris_tm_delete>div{
    position: absolute;
    width: 260px;
    height: 150px;
    left: 50%;
    top: 50%;
    margin-left: -130px;
    margin-top: -75px;
    border: 1px solid #000;
    border-radius: 10px;
    background-color: #fff;
  }
  .ris_tm_delete_head{
    height: 30px;
    text-align: right;
    background-color: #999;
    border-radius: 10px 10px 0 0 ;
  }
  .ris_tm_delete_head span{
    display: inline-block;
    padding: 0 20px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
  }
  /*文字*/
  .ris_tm_delete_text{
    line-height: 70px;
    padding-left: 20px;
    font-size: 14px;
    color: #666;
  }
  /*按钮*/
  .ris_tm_delete_btn{
    text-align: right;
  }
  .ris_tm_delete_btn button{
    width: 70px;
    background-color: #4f94cd;
    color: #fff;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    height: 30px;
    margin-right: 20px;
  }
  .ris_tm_delete_btn button:hover{
    background-color: #1888de;
  }
  .ris_tm_cont_xt_three{
    height: 46px !important;
  }
  .ris_tm_cont_left_ul>li>ul>li>ul>li>a.ecdlActive{
    color: #00dddd;
  }

</style>
